﻿#region "Copyright (C) Lenny Granovsky. 2005-2013"
//This program is free software distribute under the terms of the GNU General Public License as published by
//the Free Software Foundation. Please read AssemblyInfo.cs file for more information.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Web.Enhancements.Rest
{
    /// <summary>
    /// The attribute indicated that method should be used as a default when specified HTTP method is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpMethodAttribute : Attribute
    {
        public string HttpMethod { get; set; }

        public DefaultHttpMethodAttribute()
            : this("")
        {
        }

        public DefaultHttpMethodAttribute(string httpMethod)
            : base()
        {
            this.HttpMethod = httpMethod;
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method GET is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpGetAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpGetAttribute()
            : base("GET")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method POST is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpPostAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpPostAttribute()
            : base("POST")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method DELETE is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpDeleteAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpDeleteAttribute()
            : base("DELETE")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method PUT is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpPutAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpPutAttribute()
            : base("PUT")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method SEARCH is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpSearchAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpSearchAttribute()
            : base("SEARCH")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method COPY is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpCopyAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpCopyAttribute()
            : base("COPY")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method MOVE is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpMoveAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpMoveAttribute()
            : base("MOVE")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method UNLOCK is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpUnLockAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpUnLockAttribute()
            : base("UNLOCK")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method LOCK is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpLockAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpLockAttribute()
            : base("LOCK")
        {
        }
    }

    /// <summary>
    /// The attribute indicated that method should be used as a default when HTTP method OPTIONS is used without method name specified.
    /// </summary>
    [Serializable()]
    [AttributeUsage(AttributeTargets.Method)]
    public class DefaultHttpOptionsAttribute : DefaultHttpMethodAttribute
    {
        public DefaultHttpOptionsAttribute()
            : base("OPTIONS")
        {
        }
    }
}
